package observer.plan_2;

/**
 * @author chenyuan
 * @date 2020/10/30 9:22
 */

/**
 * 显示当前天气情况，理解为气象站自己的网站
 */
public class CurrentConditions implements Observer{
    // 温度
    public float temperature;
    // 气压
    public float pressure;
    // 湿度
    public float humidity;

    // 显示数据
    public void display(){
        System.out.println("--------CurrentConditions----------");
        System.out.println("** temperature : "+temperature+" **");
        System.out.println("** pressure : "+pressure+" **");
        System.out.println("** humidity : "+humidity+" **");
    }

    // 更新天气情况，由 WeatherData 来调用
    public void update(float temperature, float pressure, float humidity){
        this.temperature = temperature;
        this.pressure = pressure;
        this.humidity = humidity;
        display();
    }
}
